package day240200_winter_holiday_homework;

public class LinearSearch {
    public static void main(String[] args) {
        //初始数据
        int[] arr = new int[]{10, 50, 30, 70, 80, 60, 20, 90, 40};
        int target = 20;

        boolean found = false;

        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == target){
                System.out.println("在index=" + i + "的位置上找到了" + target);
                found = true;
            }
        }

        if (!found){
            System.out.println("没有找到" + target);
        }
    }
}
